﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using wt.wine.Application.ManageOrderTable;
using wt.wine.Domain.Entities;

namespace wt.wine.Application.Common.Interfaces
{
    public interface IordertableRepository
    {

        Task SendWine(string device, int num, CancellationToken cancellationtoken);

        /// <summary>
        /// 判断是否有正在出酒的订单，如果有，不再添加
        /// </summary>
        /// <param name="deviceid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> GetOrderCountByDeviceid(int deviceid, CancellationToken cancellationtoken);

        /// <summary>
        /// 添加订单
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task AddOrderInfo(ordertable model, CancellationToken cancellationtoken);

        Task<ordertable> getOrderTalbeByDeviceid(int deviceid, CancellationToken cancellationtoken);

        /// <summary>
        /// 更改订单状态
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task EditOrderTableState(ordertable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 获取订单今日销售量
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="dt_begin"></param>
        /// <param name="dt_end"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<GetOrderstatisticsByDaysDTO> GetOrderStatisticsByDays(int userid, DateTime dt_begin, DateTime dt_end, CancellationToken cancellationtoken);

        /// <summary>
        /// 获取设备状态
        /// </summary>
        /// <param name="deviceid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<ordertable> getOrderTalbeStateByDeviceid(int deviceid, int userid, CancellationToken cancellationtoken);

        Task EditOrderStateByTime(DateTime dt_time, CancellationToken cancellationtoken);

        /// <summary>
        /// 获取所有的销售订单表
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="roletype"></param>
        /// <param name="deviceid"></param>
        /// <param name="dt_begin"></param>
        /// <param name="dt_end"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<GetOrderTableListDTO> GetOrderTableListByUserId(int userid, int roletype, int deviceid, DateTime dt_begin, DateTime dt_end, int pageIndex, int pageSize, CancellationToken cancellationtoken);
    }
}
